using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestImport.View.PlatoBestellingen
{
    public partial class BestelOverzicht : Form
    {
        public BestelOverzicht()
        {
            InitializeComponent();
            this.BackColor = InstParameters.Default.schermkleur;
        }

        private void BestelOverzicht_Load(object sender, EventArgs e)
        {
            this.uitgeverTableAdapter.Fill(this.onsBoekenPakketDataSet.Uitgever);
            this.categorieTableAdapter.Fill(this.onsBoekenPakketDataSet.Categorie);
            this.bestelling_BestellingItemTableAdapter.Fill(this.onsBoekenPakketDataSet.Bestelling_BestellingItem);
            cmbFilter.SelectedIndex = 0;
            cmbFilter2.SelectedIndex = 0;
        }

        private void cmbFilter_SelectedIndexChanged(object sender, EventArgs e)
        {
            filter();
        }

        private void cmbFilter2_SelectedIndexChanged(object sender, EventArgs e)
        {
            filter();
        }

        private void filter()
        {
            int index1 = cmbFilter.SelectedIndex;
            int index2 = cmbFilter2.SelectedIndex;
            string filtertekst = "";
            if (index1 == 0 && index2 == 0) bestelling_BestellingItemBindingSource.RemoveFilter();
            else
            {
                switch (index1)
                {
                    case 0: { filtertekst = "bestellingID >= 0"; break; }
                    case 1: { filtertekst = "isRetour = false and isAnnulatie = false"; break; }
                    case 2: { filtertekst = "isAnnulatie = true"; break; }
                    case 3: { filtertekst = "isRetour = true"; break; }
                }
                switch (index2)
                {
                    case 1: { filtertekst += " and isPlato = true"; break; }
                    case 2: { filtertekst += " and isPlato = false"; break; }
                    
                }
                //Text = filtertekst;
            }
            bestelling_BestellingItemBindingSource.Filter = filtertekst;
        }



    }
}